﻿using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using System.Collections.Generic;
using DevExpress.XtraEditors;

namespace S3.Common
{
    public enum UserAction
    {
        Load,
        Save,
        Update,
        Delete
    }
    public delegate void RunLoadDataProcessHandler();
    public delegate void RunSaveDataProcessHandler();
    public delegate void RunUpdateDataProcessHandler();
    public delegate void RunDeleteDataProcessHandler();

    public class S3FormBase : XtraForm
    {
        public static Dictionary<string, string> ActionMapping;
        public event RunLoadDataProcessHandler OnLoadData;
        public event RunSaveDataProcessHandler OnSaveData;
        public event RunUpdateDataProcessHandler OnUpdateData;
        public event RunDeleteDataProcessHandler OnDeleteData;

        public S3FormBase()
        {
            Application.CurrentCulture = CultureInfo.CreateSpecificCulture("vi-VN");
            if (ActionMapping == null)
            {
                ActionMapping = new Dictionary<string, string>();
            }
        }
      
        public void RunLoadData()
        {
            if (OnLoadData != null)
            {
                OnLoadData();
            }
        }

        public void RunSaveData()
        {
            if (OnSaveData != null)
            {
                OnSaveData();
            }
        }

        public void RunUpdateData()
        {
            if (OnUpdateData != null)
            {
                OnUpdateData();
            }
        }

        public void RunDetelteData()
        {
            if (OnDeleteData != null)
            {
                OnDeleteData();
            }
        }

        public virtual void DoLoadData()
        {
            
        }

        public virtual void DoSaveData()
        {

        }

        public virtual void DoUpdateData()
        {

        }

        public virtual void DoDeleteData()
        {

        }       
    }
}
